<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>门诊发票报表管理</title>
<meta name="decorator" content="default"/>
<%-- <script src="${ctxStatic}/common/change/change.js"></script> --%>
<style type="text/css">		
	#contentTable td ,#contentTable th{
		text-align: center;
		padding: 1px 10px;
	}
	.minWidth {
		min-width: 177px;
	}	
</style>
<script type="text/javascript">
$(document).ready(function() {
	$("#btnReset").click(function(){
		$("#vaccCode").val("").select2();
		$("#companyCode").val("").select2();
		$("#patientName").val("");
		$("#doctor").val("");
		$("#localCodeId").val("");
		$("#localCodeName").val("");
		$("#presNum").val("");
		$("#beginDate").val("");
		$("#endDate").val("");
	});
	$(document).on("click","#check",function(){
		var url = "${ctx}/chargelog/bsChargeLog/findByVaccLocalCodeList?localCode="
				+$(this).parent().parent().attr("data-localCode")
				+"&department="+$(this).parent().parent().attr("data-department")
				+"&paytype="+$(this).parent().parent().attr("data-paytype")
				+"&createByName="+$(this).parent().parent().attr("data-name")
				+"&beginDate="+$("#beginDate").val()+"&endDate="+$("#endDate").val();
		layer.open({
			type : 2,
			title : '发票分疫苗统计',
			shadeClose : true,
			shade : 0.8,
			area : [screen.availWidth * 0.7 + 'px', screen.availHeight * 0.6 + 'px' ],
			content : url
		});
    });
});
function page(n,s){
	$("#pageNo").val(n);
	$("#pageSize").val(s);
	$("#searchForm").submit();
    return false;
}
function down(){
	top.$.jBox.confirm("确认导出发票金额统计数据吗？","系统提示",function(v,h,f){
		if(v=="ok"){
			$("#searchForm").attr("action","${ctx}/chargelog/bsChargeLog/payMentMoneyExport");
			$("#searchForm").submit();
			$("#searchForm").attr("action","${ctx}/chargelog/bsChargeLog/chargeLogMoney");
		}
	},{buttonsFocus:1});
	top.$('.jbox-body .jbox-icon').css('top','55px');
}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/chargelog/bsChargeLog/">发票统计</a></li>
		<li class="active"><a href="${ctx}/chargelog/bsChargeLog/chargeLogMoney">发票金额统计</a></li>
		<li><a href="${ctx}/chargelog/bsChargeLog/getVaccUse">发票分疫苗统计</a></li>
	</ul>
	<form:form id="searchForm" modelAttribute="bsChargeLog" action="${ctx}/chargelog/bsChargeLog/chargeLogMoney" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<table class="table table-bordered">
		   <tr>
				<th>地区：</th>
				<td>
				    <sys:treeselect2 id="localCode" name="localCode" value="${bsChargeLog.localCode}" labelName="areaName" labelValue="${bsChargeLog.areaName}"
					title="机构" url="/sys/office/treeData" extId="${office.id}" cssClass="input-medium" allowClear="${office.currentUser.admin}" layer = "true"/>
				</td>
			   <th>缴费起始日期</th>
				<td>
					<input name="beginDate" id ="beginDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsChargeLog.beginDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
				<th>缴费截止日期</th>
				<td>
					<input name="endDate" id ="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
						value="<fmt:formatDate value="${bsChargeLog.endDate}" pattern="yyyy-MM-dd"/>"
						onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});"/>
				</td>
			</tr>
			<tr>
		        <th>收银方式：</th>
				<td>
					<form:select path="paytype" class="span2 minWidth">
						<form:option value="" label="--请选择--"/>
						<form:options items="${fns:getDictList('payType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<th>收银员：</th>
				<td colspan = "3">
					<form:input path="createByName" id="createByName" class="span2 minWidth"/>
				</td>
			</tr>
		</table>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input type="button" class="btn btn-primary"  id="btnReset" value="重置"/>
		<input onclick="down()" class="btn btn-primary" type="button" value="导出"/>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
			    <th>编号</th>
			    <th>归属区域</th>
			    <th>接种门诊</th>
			    <th>支付方式</th>
			    <th>收银员</th>
			    <th>发票张数</th>
			    <th>缴费金额</th>
			    <th>退款金额</th>
			    <th>总计</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bsChargeLog" begin="0" varStatus="status">
			<tr data-localCode="${bsChargeLog.localCode}" data-department="${bsChargeLog.department}" 
			data-paytype="${bsChargeLog.paytype}" data-name = "${bsChargeLog.createByName}">
			    <td>
					${(page.pageNo-1)*page.pageSize+status.index+1 }
				</td>
				<td>
					${bsChargeLog.dName}
				</td>
				<td>
					<a href="javascript:;" id= "check">${bsChargeLog.department}</a>
				</td>
				<td>
					${fns:getDictLabel(bsChargeLog.paytype, 'payType', '') }
				</td>
				<td>
					${bsChargeLog.createByName}
				</td>
				<td>
					${bsChargeLog.countNum}
				</td>
				<td style = "text-align: right; padding-right: 8px">
					￥${bsChargeLog.sumPrice}
				</td>
				<td style = "text-align: right; padding-right: 8px">
					￥${bsChargeLog.updateSumPrice}
				</td>
				<td style = "text-align: right; padding-right: 8px">
					￥${bsChargeLog.sum}
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>